package docmodel;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
 * 
 * @author andrea
 *
 */
public class HTML_Marker
{
	/** */
	private StringBuffer sb;
	
	/** */
	private int id;					// 1
	
	/** */
	private String val;				 
		
	/** */
	private String text;			//NR_MESI_FIN_TOTALI(23510,L)   
	
	/** */
	private String output;			//

	/**
	 * 
	 * @param id
	 * @param val
	 */
	public HTML_Marker(int id, String val) 
	{
		sb = new StringBuffer();

		this.id	 = id;
		this.val = val;		

		output = create_output(val);		
					
		//P
		//System.out.println(toString());		
	}
		
	/**
	 * 
	 * @param input_str
	 * @return
	 */
	private String create_output(String input_str) 
	{
		output = input_str;
	    
		String span_open        = "<span ";  
		String span_open_noattr = "<span>";
		String span_close       = "</span>";
		
		String b_open        = "<b "; 
		String b_open_noattr = "<b>";
		String b_close       = "</b>";
		
		//------------------------------------------------------------------------		
		output = span_close + b_close + output + b_open_noattr + span_open_noattr;
		//------------------------------------------------------------------------
		
		return output;		
	}	
		
	/**
	 * 
	 */
	public String toString() 
	{		
		sb.append("\n");	
		sb.append("ID:          ");	
		sb.append(id);	
		sb.append("\n");
		sb.append("\n");
		sb.append("TEXT:        ");	
		sb.append(text);	
		sb.append("\n");
		sb.append("\n");
		  
		sb.append("\n");	
		
 		sb.append("\n");	
 		sb.append("\n");		
 		sb.append("VAL:    ");	
 		sb.append(val);
 		sb.append("\n");	
		 
 		sb.append("\n");	
 		sb.append("\n");		
 		sb.append("OUTPUT: ");			
 		sb.append(output);
 		sb.append("\n");	
 		sb.append("\n");	
		sb.append("\n");	
		sb.append("\n");	
		sb.append("----------------------------------------------------------------------------------");
		
		return sb.toString();		
	}
	
	/**
	 * @return the val
	 */
	public String getVal() {
		return val;
	}

	/**
	 * @param val the val to set
	 */
	public void setVal(String val) {
		this.val = val;
	}

	/**
	 * @return the output
	 */
	public String getOutput() {
		return output;
	}

	/**
	 * @param output the output to set
	 */
	public void setOutput(String output) {
		this.output = output;
	}

	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}

	/**
	 * @param text the text to set
	 */
	public void setText(String text) {
		this.text = text;
	}

}